/**
 * @Author: lll
 * @Email:li.lele@vpclub.cn
 * @Date: create in 2020/6/28
 */
package cn.vpclub.admin.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

@TableName(value = "user")
@Getter
@Setter
public class UserEntity implements Serializable {
    @ExcelProperty(value = "ID", index = 0)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ExcelProperty(value = "用户名", index = 1)
    @TableField(value = "username")
    @NotEmpty(message = "user不能为空")
    private String username;

    @NotEmpty(message = "password不能为空")
    @TableField(value = "password")
    @ExcelIgnore
    private String password;

    @ExcelIgnore
    @TableField(exist = false)
    private String passwordAgain;

    @ExcelProperty(value = "性别", index = 2)
    @NotEmpty(message = "sex不能为空")
    @TableField(value = "sex")
    private String sex;

    @ExcelProperty(value = "手机号", index = 3)
    @Pattern(regexp = "^[1][3,5,7,8][0-9]{9}$", message = "mobile不正确")
    @NotEmpty(message = "mobile不能为空")
    @TableField(value = "mobile")
    private String mobile;

    @ExcelProperty(value = "邮箱", index = 4)
    @NotEmpty(message = "email不能为空")
    @Pattern(regexp = "^\\w+@[a-z0-9]+\\.[a-z]{2,4}$", message = "email不正确")
    @TableField(value = "email")
    private String email;

    @ExcelIgnore
    @TableField(value = "picture")
    private String picture;

    @ExcelIgnore
    @TableField(value = "introduce")
    private String introduce;

    @ExcelIgnore
    @TableField(value = "role")
    private String role;

    @ExcelIgnore
    @TableField(value = "createdTime", fill = FieldFill.INSERT)
    private Date createdTime;

    @ExcelIgnore
    @TableField(value = "updatedTime", fill = FieldFill.UPDATE)
    private Date updatedTime;
}
